import 'package:ati_package/core/utils/ati_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AtiCommonBtn extends StatelessWidget {
  // 添加 onTap 事件处理
  final VoidCallback? onPressed;
  final String? titleStr;
  final Color? contenColor;
  final double? width;
  final double? height;
  final double? radius;
  final LinearGradient? btnGradient;
  final EdgeInsetsGeometry? margin;
  const AtiCommonBtn({
    super.key,
    required this.onPressed,
    this.titleStr = '',
    this.contenColor = Colors.white,
    this.width,
    this.height = 44,
    this.radius = 25,
    this.btnGradient,
    this.margin,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width,
      height: height?.r,
      margin: margin,
      decoration: BoxDecoration(
        gradient: btnGradient ?? AtiColor.primaryGradient,

        borderRadius: BorderRadius.circular(radius!),
      ),
      child: InkWell(
        onTap: onPressed, // 点击事件
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center, // 右对齐
          children: [
            Text(
              titleStr!,
              style: TextStyle(
                color: contenColor,
                fontSize: 14.r,
                fontWeight: FontWeight.w500,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
